package com.tinyseed.emcp.api.app.config;


import java.util.ArrayList;
import java.util.List;

public class DynamicDataSourceContextHolder {


    private static final ThreadLocal<Object> CONTEXT_HOLDER = new ThreadLocal<>();


    public static List<Object> dataSourceKeys = new ArrayList<>();

    public static void setDataSourceKey(String key) {
        CONTEXT_HOLDER.set(key);
    }

    public static Object getDataSourceKey() {
        return CONTEXT_HOLDER.get();
    }

    public static void clearDataSourceKey() {
        CONTEXT_HOLDER.remove();
    }

    public static Boolean containDataSourceKey(String key) {
        return dataSourceKeys.contains(key);
    }
}